package eirkdbd.lab1.obj;

import eirkdbd.lab1.log.TableObject;

public class Function implements TableObject {
	
	private String name;
	
	private String statisticName;
	
	private int min;
	
	private int max;
	
	private CBNorm join;
	
	public Function() {
		this("", "", 0, 0);
	}
	
	public Function(String name, String statisticName, int min, int max) {
		this.name = name;
		this.statisticName = statisticName;
		this.min = min;
		this.max = max;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getStatisticName() {
		return statisticName;
	}

	public void setStatisticName(String statisticName) {
		this.statisticName = statisticName;
	}

	public int getMin() {
		return min;
	}

	public void setMin(int min) {
		this.min = min;
	}

	public int getMax() {
		return max;
	}

	public void setMax(int max) {
		this.max = max;
	}
	
	public CBNorm getJoin() {
		return join;
	}

	public void setJoin(CBNorm join) {
		this.join = join;
	}

	public Object[] toObject() {
		String operator = join != null ? join.toString() : "N/A";
		return new Object[] {0, name, statisticName, min, max, operator};
	}
	
	@Override
	public String toString() {
		return name;
	}
}
